package com.company.workflow.controller;

import com.company.oa.common.api.Result;
import com.company.workflow.model.dto.AddSignDto;
import com.company.workflow.model.dto.DeleteSignDto;
import com.company.workflow.service.ProcessOperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/process/operation")
public class ProcessOperationController {

    @Autowired
    private ProcessOperationService processOperationService;

    @PostMapping("/recall/{processInstanceId}")
    public Result<Boolean> recallProcess(
            @PathVariable String processInstanceId,
            @RequestParam String taskId) {
        processOperationService.recallProcess(processInstanceId, taskId);
        return Result.success(true);
    }

    @PostMapping("/add-sign")
    public Result<Boolean> addSign(@RequestBody AddSignDto addSignDto) {
        processOperationService.addSign(addSignDto);
        return Result.success(true);
    }

    @PostMapping("/delete-sign")
    public Result<Boolean> deleteSign(@RequestBody DeleteSignDto deleteSignDto) {
        processOperationService.deleteSign(deleteSignDto);
        return Result.success(true);
    }
} 